package com.hsnn.medstgmini.model;

import java.io.Serializable;

/**
 * @category ajax返回对象
 * @author CCL 使用Pagination
 */
@Deprecated
public class Result implements Serializable {

	private static final long serialVersionUID = 1L;

	public static final int SUCCESS = 0;
	public static final int FAILED = 1;

	private int type = SUCCESS; // 成功|失败
	private Object rows; // 返回内容
	private String msg; // 失败信息

	private int total; // 总页数
	private int page; // 当前页码
	private long records; // 总记录路

	private int start;
	private int end;
	private int pagesize = 10;

	private int level;

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getRows() {
		return rows;
	}

	public void setRows(Object rows) {
		this.rows = rows;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public long getRecords() {
		return records;
	}

	public void setRecords(long records) {
		this.records = records;
		this.total = (int) Math.round(records / getPagesize() + 0.5);
	}

	public int getStart() {
		start = getPagesize() * (page - 1);
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getEnd() {
		return end;
	}

	public void setEnd(int end) {
		this.end = end;
	}

	public int getPagesize() {
		int temp = pagesize;
		try {
			if (rows != null) {
				temp = Integer.parseInt(rows.toString());
				if (temp > 30) {
					temp = 30;
				}
			}
		} catch (NumberFormatException e) {
			temp = pagesize;
		}
		pagesize = temp;
		return pagesize;
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

}
